{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li class="active"><a href="#">代理列表</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="alert alert-warning">
			代理登录地址：<a href="{$_W['siteroot']}web/cityagent.php?p=user&ac=login&do=agent_login&i={$_W['uniacid']}" target="_blank">{$_W['siteroot']}web/cityagent.php?p=user&ac=login&do=agent_login&i={$_W['uniacid']}</a>
		</div>
		<div class="filter-action">
			<a href="{php echo web_url('area/areaagent/agentEdit')}" class="btn btn-primary">添加代理</a>
<!--			<div class="pull-right"><a href="{php echo web_url('area/areaagent/agentImport')}" data-toggle='ajaxModal' class="btn btn-success">一键导入代理</a></div>-->
		</div>
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site" />
	            <input type="hidden" name="a" value="entry" />
	            <input type="hidden" name="m" value="{MODULE_NAME}" />
	            <input type="hidden" name="p" value="area" />
				<input type="hidden" name="ac" value="areaagent" />
				<input type="hidden" name="do" value="agentIndex" />
				<input type="hidden" name="status" value="{$_GPC['status']}" />
				<div class="form-group">
					<label class="col-sm-2 control-label">代理状态</label>
					<div class="col-sm-9">
						<div class="btn-group">
							<a href="{php echo wl_filter_url('status:0');}" class="btn {if intval($_GPC['status']) == 0}btn-primary{else}btn-default{/if}">不限</a>
							<a href="{php echo wl_filter_url('status:1');}" class="btn {if $_GPC['status'] == 1}btn-primary{else}btn-default{/if}">启用中</a>
							<a href="{php echo wl_filter_url('status:2');}" class="btn {if $_GPC['status'] == 2}btn-primary{else}btn-default{/if}">禁用中</a>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">代理筛选</label>
					<div class="col-sm-9">
						<input type="text" name="agentname" class="form-control" value="{$_GPC['agentname']}" placeholder="输入代理名称、联系人或者手机号"  />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<button class="btn btn-primary">筛选</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="table-responsive">
			<table class="table table-hover">
				<thead>
					<tr>
						<th style="width:10px;text-align:center;"><input type="checkbox" /></th>
						<th style="width:100px;text-align:center;">代理名称</th>
						<th style="width:100px;text-align:center;">联系人</th>
						<th style="width:100px; text-align:center;">代理分组</th>
						<th style="width:150px; text-align:center;">代理时间</th>
						<th style="width:60px; text-align:center">是否到期</th>
						<th style="width:60px; text-align:center">是否启用</th>
						<th style="width:200px; text-align:center">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $agents $agent}
					<tr>
						<td class="text-center">
							<input type="checkbox" value="{$agent['id']}" name="agentsid" />
						</td>
						<td class="text-center">
							{$agent['agentname']}
						</td>
						<td class="text-center">
							{$agent['realname']}<br />{$agent['mobile']}
						</td>
						<td class="text-center">
							<label class='label'>{$agent['groupname']}</label>
						</td>
						<td class="text-center">
							{php echo date('Y-m-d',$agent['starttime'])}至{php echo date('Y-m-d',$agent['endtime'])}
						</td>
						<td class="text-center">
							{if $agent['endtime'] < time()}<label class='label label-danger'>到期</label>{else}<label class='label label-success'>未到期</label>{/if}
						</td>
						<td class="text-center">
							{if $agent['status']==1}<label class='label label-success'>启用</label>{else}<label class='label label-default'>禁用</label>{/if}
						</td>
						<td class="text-center" style="text-align: center;">
                   		 	<a class="btn btn-default btn-sm" href="{php echo web_url('area/areaagent/agentEdit', array('id' => $agent['id']));}" title="编辑">编辑</a>
                    		<a class="btn btn-success btn-sm" href="{php echo web_url('area/areaagent/agentManage', array('id' => $agent['id']));}" target="_blank" title="管理">管理</a>
                    		<!--<a class="btn btn-danger btn-sm" href="{php echo web_url('area/areaagent/deletearea', array('id' => $agent['id']));}" data-toggle="ajaxRemove" data-confirm="删除代理会导致代理下商户和商品活动无法使用，确定要删除吗？" title="删除">删除</a>-->
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">
				<button class="btn btn-default" type="button" data-toggle='batch-remove' data-confirm="删除代理会导致代理下商户和商品活动无法使用，确定要删除吗？" data-href="{php echo web_url('area/areaagent/agentDel')}">删除代理</button>
				<button class="btn btn-default" type="button" data-toggle='batch' data-confirm="确定启用当前选中的所有代理商？" data-href="{php echo web_url('area/areaagent/changeStatus',['status'=>1])}">批量启用</button>
				<button class="btn btn-default" type="button" data-toggle='batch' data-confirm="确定禁用当前选中的所有代理商？" data-href="{php echo web_url('area/areaagent/changeStatus',['status'=>0])}">批量禁用</button>
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
{php include wl_template('common/footer');}
